using MinimalistFoodStreet.BackEnd.Infrastructure.EFCore;
using MinimalistFoodStreet.BackEnd.Infrastructure.Dtos.Response.Tables;
using MinimalistFoodStreet.BackEnd.Infrastructure.Tools;

namespace MinimalistFoodStreet.BackEnd.Server.Server.ResponseExtend.Tables 
{
    public static class EntityPromotionsExtend
    {
        public static ResponsePromotionsDto ToResponseDto(this Promotion entity)
        {
            return new ResponsePromotionsDto()
            {

                id = entity.PId,
                supplierId = entity.PSupplierId,
                goodId = entity.PGoodId,
                discountPrice = entity.PDiscountPrice,
                startTime = entity.PStartTime,
                startTimeStr = entity.PStartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                endTime = entity.PEndTime,
                endTimeStr = entity.PEndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                createAt = entity.PCreateAt,
                createAtStr = entity.PCreateAt?.ToString("yyyy-MM-dd HH:mm:ss"),
                updateAt = entity.PUpdateAt,
                updateAtStr = entity.PUpdateAt?.ToString("yyyy-MM-dd HH:mm:ss"),
            };
        }
    }
}